package com.qeeyou.apps.android.craftsman.activity.me;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.qeeyou.apps.android.craftsman.R;

public class SafeActivity extends Activity {

    private ImageView btnBack;
    private LinearLayout btnPayPassword;
    private LinearLayout btnBindMobile;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_safe);

        setView();

        setEvent();
    }

    private void setView() {
        btnBack = (ImageView) this.findViewById(R.id.btnBack4Safe);
        btnPayPassword = (LinearLayout) this.findViewById(R.id.btnPayPassword4Safe);
        btnBindMobile = (LinearLayout) this.findViewById(R.id.btnBindMobile4Safe);
    }

    private void setEvent() {
        btnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SafeActivity.this.finish();
            }
        });

        btnPayPassword.setOnClickListener(onItemClickListener);
        btnBindMobile.setOnClickListener(onItemClickListener);
    }

    private View.OnClickListener onItemClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (view == btnPayPassword) {
                Intent intent = new Intent(SafeActivity.this, PayPasswordActivity.class);
                SafeActivity.this.startActivity(intent);
            } else {
                Intent intent = new Intent(SafeActivity.this, BindMobileActivity.class);
                SafeActivity.this.startActivity(intent);
            }
        }
    };
}
